Spatial visualization of oil spill events in California.
Initial Data Wrangling
#Read in the data
oil_spill <- read_sf(here("_posts", "2021-02-25-oilspills", "oilspill","oilspill.shp")) %>%
clean_names()
ca_counties <- read_sf(here("_posts", "2021-02-25-oilspills", "ca_counties","CA_Counties_TIGER2016.shp"))
#check counties CRS
ca_counties %>% st_crs()
#check oil spill CRS
oil_spill %>% st_crs()
Creating the Interactive Map
#set tmap to interactive mode
tmap_mode(mode = "view")
#make tmap
tm_shape(ca_counties) +
tm_polygons()+
tm_shape(oil_spill)+
tm_dots()